import ThemeDao from '../../js/expand/theme/ThemeDao'

const defaultState = {
  themeColor: '#2196F3',
  showModal: false
}

const themeDao = new ThemeDao()
themeDao.getData().then(res => {
  if (res) {
    defaultState.themeColor = res
  }
})

export default (state = defaultState, action) => {
	switch(action.type) {
    case 'CHANGE_MODAL':
      obj = {...defaultState}
      obj.showModal = action.show
      return obj
    case 'CHANGE_THEME':
      obj = {...defaultState}
      obj.themeColor = action.theme
      return obj
		default:
			return state;
  }
}